<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('缴费单列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('school:bill:edit')}]];
        var removeFlag = [[${@permission.hasPermi('school:bill:remove')}]];
        var prefix = ctx + "student";
        var paymentCategoryDatas = [[${@dict.getType('sc_payment_category')}]];
        var paymentStatusDatas = [[${@dict.getType('sc_payment_status')}]];
        $(function() {
            var options = {
                url: prefix + "/pay/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "缴费单",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id', 
                    title: 'id',
                    visible: false
                },
                {
                    field: 'userName',
                    title: '用户名称'
                },
                    {
                        field: 'schoolYear',
                        title: '学年'
                    },
                    {
                        field: 'term',
                        title: '学期',
                        formatter: function(value, row, index) {
                            if(value=='1'){
                                return "第一学期";
                            }
                            if(value=='2'){
                                return "第二学期";
                            }
                        }
                    },
                {
                    field: 'paymentCategory', 
                    title: '费用类型',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(paymentCategoryDatas, value);
                    }
                },
                {
                    field: 'amount', 
                    title: '费用'
                },
                {
                    field: 'status', 
                    title: '状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(paymentStatusDatas, value);
                    }
                },

                    {
                        field: 'createTime',
                        title: '创建时间'
                    },
                {
                    field: 'paymentTime', 
                    title: '缴费时间'
                },
                {
                    field: 'paymentType', 
                    title: '缴费方式'
                },
                {
                    field: 'paymentNo', 
                    title: '缴费单号'
                },
                {
                    field: 'remark', 
                    title: '备注'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if(row.status==0){
                            actions.push('<a class="btn btn-info btn-xs"  href="javascript:toPay(\'' + row.id + '\')" ><i class="fa fa-cc-visa"></i>支付</a> ');
                        }
                        /* actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');*/
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function toPay(id) {

            //$.operate.addUrl("answer");
            $.modal.open("支付" , prefix + "/pay/toPay/"+id);

        }
    </script>
</body>
</html>